package com.gestion.abs.dao.impl;




import java.util.List;



import com.gestion.abs.bo.Etudiant;
import com.gestion.abs.dao.api.DaoEtudiant;
import com.gestion.abs.daoGeneric.GenericDaoImpl;

public class DaoEtudiantImpl extends GenericDaoImpl<Etudiant,Long> implements DaoEtudiant {

	
	
	public DaoEtudiantImpl() {
		super(Etudiant.class);
		
	}

	
	public Etudiant rechercheByCne(Long pcne) {
//		Query q=(Query) getSession().createQuery("from Etudiant where CNE= :ppcne");
//		q.setString("ppcne",pcne);
		Etudiant et=(Etudiant)getHibernateTemplate().find("from Etudiant where CNE=?", pcne);
		
		return et;
	}

	
	public Etudiant rechercheByNom(String nom) {
		Etudiant et=(Etudiant)getHibernateTemplate().find("from Etudiant where nom=? ", nom);
		
		return et;
		
	}

	
	public List<Etudiant> getListEtdByClass(Long pIdClass) {
		List<Etudiant> listEtd=getHibernateTemplate().find("from Etudiant where idClasse", pIdClass);

		return listEtd;
	}


	
	public Long getIdEtdByCne(Long pCne) {
		Etudiant et=(Etudiant) getHibernateTemplate().find("from Etudiant where cne=?",pCne);
		Long idEtd=et.getIdCompte();
		return idEtd;
	}


	
}
